import request from "../../../utils/request.ts";
import type {TradeMark} from "./type.ts";

//@ts-ignore
enum API {
    TRADEMARK_URL = '/admin/product/baseTrademark/',
    ADDTRADEMARK_URL = '/admin/product/baseTrademark/save',
    UPDATETRADEMARK_URL = '/admin/product/baseTrademark/update',
    DELETE_URL = '/admin/product/baseTrademark/remove/'
}

export const reqHasTrademark = (page: number, limit: number) => {
    return request.get<any, any>(API.TRADEMARK_URL + `${page}/${limit}`);
}

export const reqAddOrUpdateTrademark = (data: TradeMark) => {
    if (data.id) {
        return request.put<any, any>(API.UPDATETRADEMARK_URL, data);
    } else {
        return request.post<any, any>(API.ADDTRADEMARK_URL, data);
    }
}

export const reqDeleteTrademark = (id: number) => {
    return request.delete<any, any>(API.DELETE_URL + id);
}